package collection.myset;

import generalobjects.People;
import org.testng.annotations.Test;

import java.util.Comparator;
import java.util.TreeSet;
import java.util.stream.Collectors;

public class SortedSet {

    @Test
    private void t1() {
        TreeSet<People> set = new TreeSet<>(Comparator.comparingInt(People::getAge));
        People p = new People("a", 1);
        People p1 = new People("a", 1);
        People p2 = new People("b", 2);
        People p3 = new People("c", 3);

        set.add(p);
        set.add(p1);
        set.add(p2);
        set.add(p3);

        System.out.println(set);
    }

}
